<template>
  <div>
    <general-manager :generalData="generalData" @getSortTableList="getSortTableList"></general-manager>
    <div class="explain">
      以上数据仅供参考，最终以年底关账数据为准
    </div>
  </div>
</template>

<script>
import generalManager from './generalManager.vue'
import { getAssessmentInstDetail } from '@/api/home'
import sensormixin from '@/mixins'
export default {
  mixins: [sensormixin],
  data() {
    return {
      showPicker: false,
      queryParams: {
        institutionId: '', // 分公司id
        dimensionId: '', // 职位id
        /** ASC正序 DESC倒序*/
        sort: 'DESC',
        /** 得分assessmentScore 排名rank*/
        sortField: 'assessmentScore'
      },

      /** 存放次级分公司数据*/
      generalData: {}
    }
  },

  components: {
    generalManager
  },
  mounted() {
    const { institutionId, dimensionId } = this.$route.query
    this.queryParams.institutionId = institutionId
    this.queryParams.dimensionId = dimensionId
    /**默认sort和sortField为空*/
    this.queryParams.sort = ''
    this.queryParams.sortField = ''
    this.getAssessmentInstDetail().then(() => {
      try {
        this.openPerformanceBPageForSensor({}, {
          institutionName: this.generalData.institutionName
        })
      } catch (err) {
        console.log('打开综合考核评分B类页面：', err)
      }
    })
  },
  methods: {
    getSortTableList(sort, sortField) {
      this.queryParams.sort = sort
      this.queryParams.sortField = sortField
      this.getAssessmentInstDetail()
    },
    async getAssessmentInstDetail() {
      const res = await getAssessmentInstDetail(this.queryParams)
      this.generalData = res.value
    }
  }
}
</script>

<style lang="scss" scoped>
  .explain {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-bottom: 16px;
  }
</style>
